<template>
  <el-tabs
    type="border-card"
    style="margin: 0 20px; height: 93vh"
    @tab-click="tabChange"
    v-model="$store.state.activeName3"
  >
    <el-tab-pane label="单点移动量" name="单点移动量">
      <el-form inline :model="form">
        <el-form-item label="参考系类型">
          <el-select
            v-model="form.referenceName"
            @change="changeName($event)"
            size="mini"
          >
            <el-option
              label="CGCS2000坐标系"
              value="CGCS2000坐标系"
            ></el-option>
            <el-option
              label="矿区坐标高程系统"
              value="矿区坐标高程系统"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="开始时间">
          <el-date-picker
            type="date"
            placeholder="选择开始时间"
            size="mini"
            v-model="form.startTime"
            :picker-options="startTimePicker"
          ></el-date-picker>
        </el-form-item>
        <el-form-item label="结束时间">
          <el-date-picker
            type="date"
            placeholder="选择结束时间"
            size="mini"
            v-model="form.endTime"
            :picker-options="endTimePicker"
          ></el-date-picker>
        </el-form-item>
        <el-form-item label="统计时间类型">
          <el-select v-model="form.timeType" size="mini">
            <el-option label="每24小时" value="24"></el-option>
            <el-option label="每12小时" value="12"></el-option>
            <el-option label="每6小时" value="6"></el-option>
            <el-option label="每2小时" value="2"></el-option>
            <el-option label="每1小时" value="1"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item>
          <el-button type="info" size="mini" @click="getFirst">查询</el-button>
        </el-form-item>
        <el-form-item>
          <el-button
            type="warning"
            size="mini"
            @click="exportExcel('#tab', '单点移动量')"
            >导出</el-button
          >
        </el-form-item>
      </el-form>
      <el-table
        :data="tableData"
        v-show="form.referenceName == 'CGCS2000坐标系'"
        stripe
        id="tab"
      >
        <el-table-column
          prop="label"
          label="监测站点"
          align="center"
          width="90"
        ></el-table-column>
        <el-table-column
          prop="dataL"
          label="经度(°)"
          align="center"
          width="115"
        ></el-table-column>
        <el-table-column
          prop="dataB"
          label="纬度(°)"
          align="center"
          width="115"
        ></el-table-column>
        <el-table-column
          prop="dataH1"
          label="WGS84-H(m)"
          align="center"
          width="120"
        ></el-table-column>
        <el-table-column
          prop="dataGx"
          label="WGS84-x(m)"
          align="center"
          width="120"
        ></el-table-column>
        <el-table-column
          prop="dataGy"
          label="WGS84-y(m)"
          align="center"
          width="120"
        ></el-table-column>
        <el-table-column
          prop="dataH2"
          label="WGS84-ΔH(mm)"
          align="center"
          width="135"
        ></el-table-column>
        <el-table-column
          prop="dataGp"
          label="WGS84-ΔP(mm)"
          align="center"
          width="135"
        ></el-table-column>
        <el-table-column
          prop="dataGxs"
          label="WGS84-Δx(mm)"
          align="center"
          width="135"
        ></el-table-column>
        <el-table-column
          prop="dataGys"
          label="WGS84-Δy(mm)"
          align="center"
          width="135"
        ></el-table-column>
        <el-table-column
          prop="azimuth"
          label="方位角"
          align="center"
          width="85"
        ></el-table-column>
        <el-table-column
          prop="dataCount"
          label="统计数量"
          align="center"
          width="85"
        ></el-table-column>
        <el-table-column
          prop="theDate"
          label="统计时间"
          align="center"
          width="160"
        ></el-table-column>
      </el-table>
      <el-table
        :data="tableData"
        v-show="form.referenceName == '矿区坐标高程系统'"
        stripe
        id="tab"
      >
        <el-table-column
          prop="label"
          label="监测站点"
          align="center"
          width="90"
        ></el-table-column>
        <el-table-column
          prop="z54Data"
          label="1985-H(m)"
          align="center"
        ></el-table-column>
        <el-table-column
          prop="x54Data"
          label="BJ1954-x(m)"
          align="center"
        ></el-table-column>
        <el-table-column
          prop="y54Data"
          label="BJ1954-y(m)"
          align="center"
        ></el-table-column>
        <el-table-column
          prop="dataH"
          label="1985-ΔH(mm)"
          align="center"
        ></el-table-column>
        <el-table-column
          prop="dataGx"
          label="BJ1954-Δx(mm)"
          align="center"
        ></el-table-column>
        <el-table-column
          prop="dataGy"
          label="BJ1954-Δy(mm)"
          align="center"
        ></el-table-column>
        <el-table-column
          prop="azimuth"
          label="方位角"
          align="center"
        ></el-table-column>
        <el-table-column
          prop="dataCount"
          label="统计数量"
          align="center"
        ></el-table-column>
        <el-table-column
          prop="theDate"
          label="统计时间"
          align="center"
          width="160"
        ></el-table-column>
      </el-table>
      <el-row type="flex" justify="end">
        <el-col :span="10">
          <el-pagination
            background
            :current-page="pageData.currentPage"
            layout="total, prev, pager, next, jumper"
            :total="pageData.count"
            :page-size="pageData.pageSize"
            @current-change="handleCurrentChange"
            v-if="pageData.count != 0"
          >
          </el-pagination>
        </el-col>
      </el-row>
    </el-tab-pane>
    <el-tab-pane label="移动速率" name="变形速率分析">
      <el-form inline :model="form2">
        <el-form-item label="参考系类型">
          <el-select
            v-model="form2.referenceName"
            @change="changeName2($event)"
            size="mini"
          >
            <el-option
              label="CGCS2000坐标系"
              value="CGCS2000坐标系"
            ></el-option>
            <el-option
              label="矿区坐标高程系统"
              value="矿区坐标高程系统"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="开始时间">
          <el-date-picker
            type="date"
            placeholder="选择开始时间"
            size="mini"
            v-model="form2.startTime"
            :picker-options="startTimePicker2"
          ></el-date-picker>
        </el-form-item>
        <el-form-item label="结束时间">
          <el-date-picker
            type="date"
            placeholder="选择结束时间"
            size="mini"
            v-model="form2.endTime"
            :picker-options="endTimePicker2"
          ></el-date-picker>
        </el-form-item>
        <el-form-item label="统计时间类型">
          <el-select
            v-model="form2.timeType"
            @change="changeTimeType($event)"
            size="mini"
          >
            <el-option label="每24小时" value="24"></el-option>
            <el-option label="每12小时" value="12"></el-option>
            <el-option label="每6小时" value="6"></el-option>
            <el-option label="每2小时" value="2"></el-option>
            <el-option label="每1小时" value="1"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item>
          <el-button type="info" size="mini" @click="getTwo">查询</el-button>
        </el-form-item>
        <el-form-item>
          <el-button
            type="warning"
            size="mini"
            @click="exportExcel2('#tab2', '移动速率')"
            >导出</el-button
          >
        </el-form-item>
      </el-form>
      <el-table
        :data="tableData2"
        v-show="form2.referenceName == 'CGCS2000坐标系'"
        stripe
        id="tab2"
      >
        <el-table-column
          prop="label"
          label="监测站点"
          align="center"
          width="90"
        ></el-table-column>
        <el-table-column
          prop="dataL"
          label="经度(°)"
          align="center"
        ></el-table-column>
        <el-table-column
          prop="dataB"
          label="纬度(°)"
          align="center"
        ></el-table-column>
        <el-table-column
          v-if="form2.timeType === '24'"
          key="1"
          prop="ghSpeed"
          label="WGS84-Vh(mm/24h)"
          align="center"
        ></el-table-column>
        <el-table-column
          v-if="form2.timeType === '24'"
          key="2"
          prop="gxSpeed"
          label="WGS84-Vx(mm/24h)"
          align="center"
        ></el-table-column>
        <el-table-column
          v-if="form2.timeType === '24'"
          key="3"
          prop="gySpeed"
          label="WGS84-Vy(mm/24h)"
          align="center"
        ></el-table-column>
        <el-table-column
          v-if="form2.timeType === '12'"
          key="1"
          prop="ghSpeed"
          label="WGS84-Vh(mm/12h)"
          align="center"
        ></el-table-column>
        <el-table-column
          v-if="form2.timeType === '12'"
          key="2"
          prop="gxSpeed"
          label="WGS84-Vx(mm/12h)"
          align="center"
        ></el-table-column>
        <el-table-column
          v-if="form2.timeType === '12'"
          key="3"
          prop="gySpeed"
          label="WGS84-Vy(mm/12h)"
          align="center"
        ></el-table-column>
        <el-table-column
          v-if="form2.timeType === '6'"
          key="1"
          prop="ghSpeed"
          label="WGS84-Vh(mm/6h)"
          align="center"
        ></el-table-column>
        <el-table-column
          v-if="form2.timeType === '6'"
          key="2"
          prop="gxSpeed"
          label="WGS84-Vx(mm/6h)"
          align="center"
        ></el-table-column>
        <el-table-column
          v-if="form2.timeType === '6'"
          key="3"
          prop="gySpeed"
          label="WGS84-Vy(mm/6h)"
          align="center"
        ></el-table-column>
        <el-table-column
          v-if="form2.timeType === '2'"
          key="1"
          prop="ghSpeed"
          label="WGS84-Vh(mm/2h)"
          align="center"
        ></el-table-column>
        <el-table-column
          v-if="form2.timeType === '2'"
          key="2"
          prop="gxSpeed"
          label="WGS84-Vx(mm/2h)"
          align="center"
        ></el-table-column>
        <el-table-column
          v-if="form2.timeType === '2'"
          key="3"
          prop="gySpeed"
          label="WGS84-Vy(mm/2h)"
          align="center"
        ></el-table-column>
        <el-table-column
          v-if="form2.timeType === '1'"
          key="1"
          prop="ghSpeed"
          label="WGS84-Vh(mm/1h)"
          align="center"
        ></el-table-column>
        <el-table-column
          v-if="form2.timeType === '1'"
          key="2"
          prop="gxSpeed"
          label="WGS84-Vx(mm/1h)"
          align="center"
        ></el-table-column>
        <el-table-column
          v-if="form2.timeType === '1'"
          key="3"
          prop="gySpeed"
          label="WGS84-Vy(mm/1h)"
          align="center"
        ></el-table-column>
        <el-table-column
          prop="dataCount"
          label="统计数量"
          align="center"
        ></el-table-column>
        <el-table-column
          prop="theDate"
          label="统计时间"
          align="center"
          width="160"
        ></el-table-column>
      </el-table>
      <el-table
        :data="tableData2"
        v-show="form2.referenceName == '矿区坐标高程系统'"
        stripe
        id="tab2"
      >
        <el-table-column
          prop="label"
          label="监测站点"
          align="center"
          width="90"
        ></el-table-column>
        <el-table-column
          v-if="form2.timeType == '24'"
          key="1"
          prop="gh54Speed"
          label="1985-Vh(mm/24h)"
          align="center"
        ></el-table-column>
        <el-table-column
          v-if="form2.timeType == '12'"
          key="1"
          prop="gh54Speed"
          label="1985-Vh(mm/12h)"
          align="center"
        ></el-table-column>
        <el-table-column
          v-if="form2.timeType == '6'"
          key="1"
          prop="gh54Speed"
          label="1985-Vh(mm/6h)"
          align="center"
        ></el-table-column>
        <el-table-column
          v-if="form2.timeType == '2'"
          key="1"
          prop="gh54Speed"
          label="1985-Vh(mm/2h)"
          align="center"
        ></el-table-column>
        <el-table-column
          v-if="form2.timeType == '1'"
          key="1"
          prop="gh54Speed"
          label="1985-Vh(mm/1h)"
          align="center"
        ></el-table-column>
        <el-table-column
          v-if="form2.timeType == '24'"
          key="2"
          prop="gx54Speed"
          label="BJ1954-Vx(mm/24h)"
          align="center"
        ></el-table-column>
        <el-table-column
          v-if="form2.timeType == '12'"
          key="2"
          prop="gx54Speed"
          label="BJ1954-Vx(mm/12h)"
          align="center"
        ></el-table-column>
        <el-table-column
          v-if="form2.timeType == '6'"
          key="2"
          prop="gx54Speed"
          label="BJ1954-Vx(mm/6h)"
          align="center"
        ></el-table-column>
        <el-table-column
          v-if="form2.timeType == '2'"
          key="2"
          prop="gx54Speed"
          label="BJ1954-Vx(mm/2h)"
          align="center"
        ></el-table-column>
        <el-table-column
          v-if="form2.timeType == '1'"
          key="2"
          prop="gx54Speed"
          label="BJ1954-Vx(mm/1h)"
          align="center"
        ></el-table-column>
        <el-table-column
          v-if="form2.timeType == '24'"
          key="3"
          prop="gy54Speed"
          label="BJ1954-Vy(mm/24h)"
          align="center"
        ></el-table-column>
        <el-table-column
          v-if="form2.timeType == '12'"
          key="3"
          prop="gy54Speed"
          label="BJ1954-Vy(mm/12h)"
          align="center"
        ></el-table-column>
        <el-table-column
          v-if="form2.timeType == '6'"
          key="3"
          prop="gy54Speed"
          label="BJ1954-Vy(mm/6h)"
          align="center"
        ></el-table-column>
        <el-table-column
          v-if="form2.timeType == '2'"
          key="3"
          prop="gy54Speed"
          label="BJ1954-Vy(mm/2h)"
          align="center"
        ></el-table-column>
        <el-table-column
          v-if="form2.timeType == '1'"
          key="3"
          prop="gy54Speed"
          label="BJ1954-Vy(mm/1h)"
          align="center"
        ></el-table-column>
        <el-table-column
          prop="dataCount"
          label="统计数量"
          align="center"
        ></el-table-column>
        <el-table-column
          prop="theDate"
          label="统计时间"
          align="center"
          width="160"
        ></el-table-column>
      </el-table>
      <el-row type="flex" justify="end">
        <el-col :span="10">
          <el-pagination
            background
            :current-page="pageData2.currentPage"
            layout="total, prev, pager, next, jumper"
            :total="pageData2.count"
            :page-size="pageData2.pageSize"
            @current-change="handleCurrentChange2"
            v-if="pageData2.count != 0"
          >
          </el-pagination>
        </el-col>
      </el-row>
    </el-tab-pane>
    <!-- <el-tab-pane label="静态数据分析检验" name="静态数据分析检验">
      <el-form inline :model="form3">
        <el-form-item label="参考系类型">
          <el-select
            v-model="form3.referenceName"
            @change="changeName3($event)"
            size="mini"
          >
            <el-option
              label="CGCS2000坐标系"
              value="CGCS2000坐标系"
            ></el-option>
            <el-option
              label="矿区坐标高程系统"
              value="矿区坐标高程系统"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="开始时间">
          <el-date-picker
            type="date"
            placeholder="选择开始时间"
            size="mini"
            v-model="form3.startTime"
            :picker-options="startTimePicker"
          ></el-date-picker>
        </el-form-item>
        <el-form-item label="结束时间">
          <el-date-picker
            type="date"
            placeholder="选择结束时间"
            size="mini"
            v-model="form3.endTime"
            :picker-options="endTimePicker"
          ></el-date-picker>
        </el-form-item>
        <el-form-item>
          <el-button type="info" size="mini" @click="getThree">查询</el-button>
        </el-form-item>
        <el-form-item>
          <el-button
            type="warning"
            size="mini"
            @click="exportExcel3('#tab3', '静态数据分析检验')"
            >导出</el-button
          >
        </el-form-item>
      </el-form>
      <el-table :data="tableData3" stripe id="tab3">
        <el-table-column
          label="监测站点"
          align="center"
          prop="label"
          width="80"
        ></el-table-column>
        <el-table-column
          label="WGS84-ΔH(mm)"
          align="center"
          prop="dataH"
          width="135"
        ></el-table-column>
        <el-table-column
          label="WGS84-Δx(mm)"
          align="center"
          prop="dataGx"
          width="135"
        ></el-table-column>
        <el-table-column
          label="WGS84-Δy(mm)"
          align="center"
          prop="dataGy"
          width="135"
        ></el-table-column>
        <el-table-column
          label="std_x(mm)"
          align="center"
          prop="stdx"
        ></el-table-column>
        <el-table-column
          label="std_y(mm)"
          align="center"
          prop="stdy"
        ></el-table-column>
        <el-table-column
          label="std_h(mm)"
          align="center"
          prop="stdh"
        ></el-table-column>
        <el-table-column
          label="std_l(mm)"
          align="center"
          prop="stdl"
        ></el-table-column>
        <el-table-column
          label="完整率（%）"
          align="center"
          prop="integrityRate"
        ></el-table-column>
        <el-table-column
          label="有效观测率（%）"
          align="center"
          prop="effectiveObservationRate"
          width="135"
        ></el-table-column>
        <el-table-column
          label="MP1(m)"
          align="center"
          prop="mP1"
        ></el-table-column>
        <el-table-column
          label="MP2(m)"
          align="center"
          prop="mP2"
        ></el-table-column>
        <el-table-column
          label="观测值/周跳"
          align="center"
          prop="oSlps"
        ></el-table-column>
        <el-table-column
          label="统计时间"
          align="center"
          prop="theTime"
        ></el-table-column>
      </el-table>
      <el-row type="flex" justify="end">
        <el-col :span="10">
          <el-pagination
            background
            :current-page="pageData3.currentPage"
            layout="total, prev, pager, next, jumper"
            :total="pageData3.count"
            :page-size="pageData3.pageSize"
            @current-change="handleCurrentChange3"
            v-if="pageData3.count != 0"
          >
          </el-pagination>
        </el-col>
      </el-row>
    </el-tab-pane> -->
  </el-tabs>
</template>

<script>
import Axios from "axios";
import moment from "moment";
import FileSaver from "file-saver";
import XLSX from "xlsx";
// import { json2excel } from "@/excel/setMethods";

import * as serviceApi from "../../../common/service.config";
Axios.defaults.withcredentials = true;

export default {
  name: "BeiDou",
  props: {
    node: Object,
  },
  data() {
    return {
      form: {
        referenceName: "CGCS2000坐标系",
        referenceType: "default",
        timeType: "24",
        startTime: "2021-05-21",
        endTime: moment().format("YYYY-MM-DD"),
        startTimeMin: null,
      },
      tableData: null,
      pageData: {
        currentPage: null,
        count: null,
        pageSize: null,
      },
      form2: {
        referenceName: "CGCS2000坐标系",
        referenceType: "default",
        timeType: "24",
        startTime: "2021-05-21",
        endTime: moment().format("YYYY-MM-DD"),
        startTimeMin: null,
      },
      tableData2: null,
      pageData2: {
        currentPage: null,
        count: null,
        pageSize: null,
      },
      form3: {
        referenceName: "CGCS2000坐标系",
        referenceType: "default",
        timeType: "24",
        startTime: "2021-05-21",
        endTime: moment().format("YYYY-MM-DD"),
        startTimeMin: null,
      },
      tableData3: null,
      pageData3: {
        currentPage: null,
        count: null,
        pageSize: null,
      },
      startTime: "",
      nameChange: "",
      nameChange2: "",
      nameChange3: "",
      timeTypeChange: "",
    };
  },
  computed: {
    startTimePicker() {
      return {
        disabledDate: (time) =>
          this.form.startTime
            ? time.getTime() < new Date(this.startTime).getTime() ||
              time.getTime() > new Date(this.form.endTime).getTime()
            : false,
      };
    },
    endTimePicker() {
      return {
        disabledDate: (time) =>
          this.form.endTime
            ? time.getTime() > new Date().getTime() ||
              time.getTime() < new Date(this.form.startTime).getTime()
            : false,
      };
    },
    startTimePicker2() {
      return {
        disabledDate: (time) =>
          this.form2.startTime
            ? time.getTime() < new Date(this.startTime).getTime() ||
              time.getTime() > new Date(this.form2.endTime).getTime()
            : false,
      };
    },
    endTimePicker2() {
      return {
        disabledDate: (time) =>
          this.form2.endTime
            ? time.getTime() > new Date().getTime() ||
              time.getTime() < new Date(this.form2.startTime).getTime()
            : false,
      };
    },
  },
  created() {
    this.getFirst();
    this.getTwo();
    this.getThree();
  },
  methods: {
    tabChange(tab) {
      this.$store.dispatch("getTabName3", tab.paneName);
      if (this.form.referenceName == "矿区坐标高程系统") {
        this.form.referenceName = "CGCS2000坐标系";
        this.form.referenceType = "default";
      }
    },
    changeName(name) {
      this.nameChange = name;
      this.getFirst();
    },
    getFirst() {
      Axios({
        url: serviceApi.KB_API,
        method: "post",
        data: `appMsg={"parameter":"{\\"sensorNumber\\":\\"${this.node.sensorNumber}\\",\\"timeType\\":\\"24\\",\\"dataType\\":\\"01\\"}","serviceCode":"queryInitStartTime","timestamp":"","uuid":""}`,
      }).then((res) => {
        this.startTime = res.data.parameter.startTime;
        this.form.startTime = moment(this.form.startTime).format("YYYY-MM-DD");
        this.form.startTimeMin = this.startTime;
        if (this.nameChange == "") {
          this.nameChange = "CGCS2000坐标系";
        }
        let queryData = {
          startTime: this.form.startTime,
          endTime: moment().format("YYYY-MM-DD"),
          referenceName: this.nameChange,
          timeType: this.form.timeType,
        };
        if (queryData.referenceName == "CGCS2000坐标系") {
          this.form.referenceType = "default";
        } else if (queryData.referenceName == "矿区坐标高程系统") {
          this.form.referenceType = "bj54";
        }
        Axios({
          url: serviceApi.KB_API,
          method: "post",
          data: `appMsg={"parameter":"{\\"referenceName\\":\\"${this.form.referenceName}\\",\\"referenceType\\":\\"${this.form.referenceType}\\",\\"sensorNumber\\":\\"${this.node.sensorNumber}\\",\\"startTime\\":\\"${this.form.startTime}\\",\\"endTime\\":\\"${queryData.endTime}\\",\\"page\\":{\\"currentPage\\":1,\\"pageSize\\":10},\\"timeType\\":\\"${queryData.timeType}\\"}","serviceCode":"queryBeiDouHistory","timestamp":"","uuid":""}`,
        }).then((res) => {
          this.pageData = res.data.parameter.page;
          let list = res.data.parameter.list,
            firstDto = res.data.parameter.firstDto;
          this.singlePoint(list, firstDto);
        });
      });
    },
    changeName2(name) {
      this.nameChange2 = name;
      this.getTwo();
    },
    changeTimeType(timeType) {
      this.timeTypeChange = timeType;
      this.getTwo();
    },
    getTwo() {
      this.form2.startTime = moment(this.form2.startTime).format("YYYY-MM-DD");
      this.form2.startTimeMin = this.startTime;
      if (this.nameChange2 == "") {
        this.nameChange2 = "CGCS2000坐标系";
      }
      let queryData = {
        startTime: this.form2.startTime,
        endTime: moment().format("YYYY-MM-DD"),
        referenceName: this.nameChange2,
        timeType: this.form2.timeType,
      };
      if (queryData.referenceName == "CGCS2000坐标系") {
        this.form2.referenceType = "default";
      } else if (queryData.referenceName == "矿区坐标高程系统") {
        this.form2.referenceType = "bj54";
      }
      Axios({
        url: serviceApi.KB_API,
        method: "post",
        data: `appMsg={"parameter":"{\\"referenceName\\":\\"${this.form2.referenceName}\\",\\"referenceType\\":\\"${this.form2.referenceType}\\",\\"sensorNumber\\":\\"${this.node.sensorNumber}\\",\\"startTime\\":\\"${this.form2.startTime}\\",\\"endTime\\":\\"${queryData.endTime}\\",\\"page\\":{\\"currentPage\\":1,\\"pageSize\\":10},\\"timeType\\":\\"${queryData.timeType}\\"}","serviceCode":"queryBeiDouHistory","timestamp":"","uuid":""}`,
      }).then((res) => {
        this.pageData2 = res.data.parameter.page;
        let list = res.data.parameter.list;
        this.deformationRate(list);
      });
    },
    changeName3(name) {
      this.nameChange3 = name;
      this.getTwo();
    },
    getThree() {
      this.form3.startTime = moment(this.form3.startTime).format("YYYY-MM-DD");
      this.form3.startTimeMin = this.startTime;
      if (this.nameChange3 == "") {
        this.nameChange3 = "CGCS2000坐标系";
      }
      let queryData = {
        startTime: this.form3.startTime,
        endTime: moment().format("YYYY-MM-DD"),
        referenceName: this.nameChange3,
        timeType: this.form3.timeType,
      };
      if (queryData.referenceName == "CGCS2000坐标系") {
        this.form3.referenceType = "default";
      } else if (queryData.referenceName == "矿区坐标高程系统") {
        this.form3.referenceType = "bj54";
      }
      Axios({
        url: serviceApi.KB_API,
        method: "post",
        data: `appMsg={"parameter":"{\\"referenceName\\":\\"${this.form3.referenceName}\\",\\"referenceType\\":\\"${this.form3.referenceType}\\",\\"sensorNumber\\":\\"${this.node.sensorNumber}\\",\\"startTime\\":\\"${this.form3.startTime}\\",\\"endTime\\":\\"${queryData.endTime}\\",\\"page\\":{\\"currentPage\\":1,\\"pageSize\\":10},\\"timeType\\":\\"0\\"}","serviceCode":"queryBeiDouStaticQuality","timestamp":"","uuid":""}`,
      }).then((res) => {
        this.pageData3 = res.data.parameter.page;
        let list = res.data.parameter.list,
          firstDmo = res.data.parameter.firstDmo;
        this.staticData(list, firstDmo);
      });
    },
    singlePoint(list, firstDto) {
      if (this.form.referenceName == "CGCS2000坐标系") {
        for (let i = 0, len = list.length; i < len; i++) {
          list[i].label = this.node.label;
          list[i].dataL = Number(list[i].dataL).toFixed(8);
          list[i].dataB = Number(list[i].dataB).toFixed(8);
          list[i].dataH1 = list[i].dataH.toFixed(4);
          list[i].dataGx = list[i].dataGx.toFixed(4);
          list[i].dataGy = list[i].dataGy.toFixed(4);
          list[i].dataH2 = ((list[i].dataH - firstDto.dataH) * 1000).toFixed(1);
          list[i].dataGp = (list[i].dataGp * 1000).toFixed(1);
          list[i].dataGxs = ((list[i].dataGx - firstDto.dataGx) * 1000).toFixed(
            1
          );
          list[i].dataGys = ((list[i].dataGy - firstDto.dataGy) * 1000).toFixed(
            1
          );
          list[i].azimuth = list[i].azimuth.toFixed(1);
          list[i].theDate = moment(list[i].theDate).format(
            "YYYY-MM-DD HH:mm:ss"
          );
        }
      } else if (this.form.referenceName == "矿区坐标高程系统") {
        for (let i = 0, len = list.length; i < len; i++) {
          list[i].label = this.node.label;
          if (list[i].z54Data) {
            list[i].z54Data = Number(list[i].z54Data).toFixed(4);
            list[i].dataH = (
              Number(list[i].z54Data - firstDto.z54Data) * 1000
            ).toFixed(1);
          } else {
            list[i].z54Data = "/";
            list[i].dataH = "/";
          }
          if (list[i].x54Data) {
            list[i].x54Data = Number(list[i].x54Data).toFixed(4);
            list[i].dataGx = (
              Number(list[i].x54Data - firstDto.x54Data) * 1000
            ).toFixed(1);
          } else {
            list[i].x54Data = "/";
            list[i].dataGx = "/";
          }
          if (list[i].y54Data) {
            list[i].y54Data = Number(list[i].y54Data).toFixed(4);
            list[i].dataGy = (
              Number(list[i].y54Data - firstDto.y54Data) * 1000
            ).toFixed(1);
          } else {
            list[i].y54Data = "/";
            list[i].dataGy = "/";
          }
          list[i].azimuth = list[i].azimuth.toFixed(1);
          list[i].theDate = moment(list[i].theDate).format(
            "YYYY-MM-DD HH:mm:ss"
          );
        }
      }

      this.tableData = list;
    },
    search(currentPage) {
      let queryData = {
        startTime: moment(this.form.startTime).format("YYYY-MM-DD"),
        endTime: moment(this.form.endTime).format("YYYY-MM-DD"),
        timeType: this.form.timeType,
      };
      Axios({
        url: serviceApi.KB_API,
        method: "post",
        data: `appMsg={"parameter":"{\\"sensorNumber\\":\\"${this.node.sensorNumber}\\",\\"startTime\\":\\"${queryData.startTime}\\",\\"endTime\\":\\"${queryData.endTime}\\",\\"page\\":{\\"currentPage\\":${currentPage},\\"pageSize\\":10},\\"timeType\\":\\"${queryData.timeType}\\"}","serviceCode":"queryBeiDouHistory","timestamp":"","uuid":""}`,
      }).then((res) => {
        this.pageData = res.data.parameter.page;
        let list = res.data.parameter.list,
          firstDto = res.data.parameter.firstDto;
        this.singlePoint(list, firstDto);
      });
    },
    handleCurrentChange(val) {
      this.search(val);
    },
    deformationRate(list) {
      if (this.form2.referenceName == "CGCS2000坐标系") {
        for (let i = 0, len = list.length; i < len; i++) {
          list[i].label = this.node.label;
          list[i].dataL = Number(list[i].dataL).toFixed(8);
          list[i].dataB = Number(list[i].dataB).toFixed(8);
          list[i].ghSpeed = (list[i].ghSpeed * 1000).toFixed(1);
          list[i].gxSpeed = (list[i].gxSpeed * 1000).toFixed(1);
          list[i].gySpeed = (list[i].gySpeed * 1000).toFixed(1);
          list[i].theDate = moment(list[i].theDate).format(
            "YYYY-MM-DD HH:mm:ss"
          );
        }
      } else if (this.form2.referenceName == "矿区坐标高程系统") {
        for (let i = 0, len = list.length; i < len; i++) {
          list[i].label = this.node.label;
          list[i].gh54Speed = (Number(list[i].gh54Speed) * 1000).toFixed(1);
          list[i].gx54Speed = (Number(list[i].gx54Speed) * 1000).toFixed(1);
          list[i].gy54Speed = (Number(list[i].gy54Speed) * 1000).toFixed(1);
          list[i].theDate = moment(list[i].theDate).format(
            "YYYY-MM-DD HH:mm:ss"
          );
        }
      }
      this.tableData2 = list;
    },
    search2(currentPage) {
      let queryData = {
        startTime: moment(this.form2.startTime).format("YYYY-MM-DD"),
        endTime: moment(this.form2.endTime).format("YYYY-MM-DD"),
        timeType: this.form2.timeType,
      };
      Axios({
        url: serviceApi.KB_API,
        method: "post",
        data: `appMsg={"parameter":"{\\"sensorNumber\\":\\"${this.node.sensorNumber}\\",\\"startTime\\":\\"${queryData.startTime}\\",\\"endTime\\":\\"${queryData.endTime}\\",\\"page\\":{\\"currentPage\\":${currentPage},\\"pageSize\\":10},\\"timeType\\":\\"${queryData.timeType}\\"}","serviceCode":"queryBeiDouHistory","timestamp":"","uuid":""}`,
      }).then((res) => {
        this.pageData2 = res.data.parameter.page;
        let list = res.data.parameter.list;
        this.deformationRate(list);
      });
    },
    handleCurrentChange2(val) {
      this.search2(val);
    },
    staticData(list, firstDmo) {
      for (let i = 0, len = list.length; i < len; i++) {
        list[i].label = this.node.label;
        list[i].dataH = ((list[i].dataH - firstDmo.dataH) * 1000).toFixed(1);
        list[i].dataGx = ((list[i].dataGx - firstDmo.dataGx) * 1000).toFixed(1);
        list[i].dataGy = ((list[i].dataGy - firstDmo.dataGy) * 1000).toFixed(1);
        list[i].stdx = list[i].stdx.toFixed(1);
        list[i].stdy = list[i].stdy.toFixed(1);
        list[i].stdh = list[i].stdh.toFixed(1);
        list[i].stdl = list[i].stdl.toFixed(1);
        list[i].theDate = moment(list[i].theDate).format("YYYY-MM-DD HH:mm:ss");
      }
      this.tableData3 = list;
    },
    search3(currentPage) {
      let queryData = {
        startTime: moment(this.form2.startTime).format("YYYY-MM-DD"),
        endTime: moment(this.form2.endTime).format("YYYY-MM-DD"),
      };
      Axios({
        url: serviceApi.KB_API,
        method: "post",
        data: `appMsg={"parameter":"{\\"sensorNumber\\":\\"${this.node.sensorNumber}\\",\\"startTime\\":\\"${queryData.startTime}\\",\\"endTime\\":\\"${queryData.endTime}\\",\\"page\\":{\\"currentPage\\":${currentPage},\\"pageSize\\":10},\\"timeType\\":\\"0\\"}","serviceCode":"queryBeiDouStaticQuality","timestamp":"","uuid":""}`,
      }).then((res) => {
        this.pageData3 = res.data.parameter.page;
        let list = res.data.parameter.list,
          firstDmo = res.data.parameter.firstDmo;
        this.staticData(list, firstDmo);
      });
    },
    handleCurrentChange3(val) {
      this.search3(val);
    },
    exportExcel(dom, title) {
      /* out-table关联导出的dom节点  */
      var wb = XLSX.utils.table_to_book(document.querySelector(dom));
      /* get binary string as output */
      var wbout = XLSX.write(wb, {
        bookType: "xlsx",
        bookSST: true,
        type: "array",
      });
      try {
        FileSaver.saveAs(
          new Blob([wbout], { type: "application/octet-stream" }),
          `${this.node.label}-${moment(this.form.startTime).format(
            "YYYYMMDD"
          )}至${moment(this.form.endTime).format("YYYYMMDD")}-${title}(${
            this.form.timeType
          }小时,${this.form.referenceName}).xlsx`
        );
      } catch (e) {
        if (typeof console !== "undefined") console.log(e, wbout);
      }
      return wbout;
    },
    exportExcel2(dom, title) {
      /* out-table关联导出的dom节点  */
      var wb = XLSX.utils.table_to_book(document.querySelector(dom));
      /* get binary string as output */
      var wbout = XLSX.write(wb, {
        bookType: "xlsx",
        bookSST: true,
        type: "array",
      });
      try {
        FileSaver.saveAs(
          new Blob([wbout], { type: "application/octet-stream" }),
          `${this.node.label}-${moment(this.form2.startTime).format(
            "YYYYMMDD"
          )}至${moment(this.form2.endTime).format("YYYYMMDD")}-${title}(${
            this.form2.timeType
          }小时,${this.form2.referenceName}).xlsx`
        );
      } catch (e) {
        if (typeof console !== "undefined") console.log(e, wbout);
      }
      return wbout;
    },
    exportExcel3(dom, title) {
      /* out-table关联导出的dom节点  */
      var wb = XLSX.utils.table_to_book(document.querySelector(dom));
      /* get binary string as output */
      var wbout = XLSX.write(wb, {
        bookType: "xlsx",
        bookSST: true,
        type: "array",
      });
      try {
        FileSaver.saveAs(
          new Blob([wbout], { type: "application/octet-stream" }),
          `${this.node.label}${title}.xlsx`
        );
      } catch (e) {
        if (typeof console !== "undefined") console.log(e, wbout);
      }
      return wbout;
    },
  },
};
</script>
<style lang="less" scoped>
.el-table {
  display: block;
  height: 66vh;
  overflow: auto;
  margin-bottom: 40px;
}
.el-table::before {
  z-index: inherit;
}
</style>